<%= csrf_meta_tags %>

<% available_locales.excluding(current_locale).each do |locale| %>
  <link rel="alternate" href="<%= canonical_url(request.url, locale) %>" hreflang="<%= locale %>">
<% end %>

<%= tag :meta, name: "viewport", content: "width=device-width, initial-scale=1.0" %>

<%= tag :meta, name: "twitter:card", content: "summary_large_image" %>
<%= tag :meta, name: "twitter:site", content: "@#{decidim_meta_twitter_handler}" %>
<%= tag :meta, name: "twitter:title", content: decidim_page_title %>
<%= tag :meta, name: "twitter:description", content: decidim_meta_description %>
<%= tag :meta, name: "twitter:image", content: decidim_meta_image_url.presence || "" %>

<%= tag :meta, property: "og:image", content: decidim_meta_image_url.presence || "" %>
<%= tag :meta, property: "og:type", content: "article" %>
<%= tag :meta, property: "og:title", content: decidim_page_title %>
<%= tag :meta, property: "og:description", content: decidim_meta_description %>
<%= tag :meta, property: "og:url", content: decidim_meta_url %>

<% if current_organization.colors.present? %>
  <%= tag :meta, name: "theme-color", content: current_organization.colors["primary"] %>
<% end %>

<%= render partial: "layouts/decidim/meta_tags_context" %>

<%= legacy_favicon %>
<%= favicon %>
<%= apple_favicon %>
<link rel="manifest" href="/manifest.webmanifest">

<%= prepend_javascript_pack_tag "decidim_core", defer: false %>
<%= append_stylesheet_pack_tag "decidim_overrides", media: "all" %>
<%= stylesheet_pack_tag "decidim_core", media: "all" %>
<%= yield :css_content %>

<%= invisible_captcha_styles %>
<%= organization_colors %>

<%= render partial: "layouts/decidim/head_extra" %>
<%== current_organization.header_snippets if Decidim.enable_html_header_snippets %>
<%= snippets.display(:head) %>
<%= content_for :header_snippets %>
